<%-- 
    Document   : Corsi_Segreteria
    Created on : 15-mag-2012, 10.53.47
    Author     : aleX
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="Utils.Corso_base "%>
<%@page import="Utils.Corso "%>
<!DOCTYPE html>
<html>
    
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Corsi</title>

  <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <!-- Chiamata al css contenente la grafica -->
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
  <link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.8.19.custom.css" >
  <script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js" ></script>

 <style type="text/css">
        #selectable .ui-selecting { background: #FFFFFF; }
	#selectable .ui-selected { background: #99CBFF; color: black; border: #34FF12; }
</style>

<script type="text/javascript">
	$(function() {
		$("#selectable").selectable(
                { filter : 'tr',                 
                  stop: function() 
                    {
                        
                        str = ($(".ui-selected",this).attr("id"));
                            if(str.match("Row-0"))
                                    $(".ui-selected",this).removeClass("ui-selected");
                            else
                                {
                                document.location.href = "Corsi_Segreteria?ID="+(get_selected_index()-1);
                                }
			$(".ui-selected",this).each(function() {
                               $(this).siblings().removeClass("ui-selected");         
		     })}})
	});
        
       function get_selected_index(){
         var elim = document.getElementById(str);
         var x = elim.rowIndex;
         return x;
       }
 
</script>

<script>
            $(document).ready(function (){
                var x = $(document).height();
                $('#Bottom_bar').css("top", (x+118)+"px");
                $('#Menu_background').css("height" , x+"px");
            });

</script> 

</head>

<body>
    
            <jsp:useBean id="result" scope="request" class="java.util.List <Corso> "></jsp:useBean>
            
            <jsp:useBean id="corso" scope="request" class="Utils.Corso" ></jsp:useBean>

<div id="Menu_background"> </div>
<div id="Top_bar"> </div>
<div id="Bottom_bar"> </div>

<div id="Header">

	<div id="LOGO_UNITN" class="image" style="position:absolute;left:26px;top:15px;width:339px;height:93px;z-index:0;padding:0;">
	<img src="images/logo_unitn1.gif" id="Image1" alt="" border="0" style="width:339px;height:93px;"></div>

</div>

<div id="SlideMenu1">
<ul class="nav nav-list">
  <li class="nav-header">
    segreteria
  </li>
  <li>
    <a href="Studenti_Segreteria">Studenti</a>
  </li>
  <li class="active">
    <a href="Corsi_Segreteria">Corsi</a>
  </li>
  <li>
    <a href="Logout">Logout</a>
  </li>
</ul>
</div>

<div style="position:absolute;left:190px;top:162px">
    <h3>Ricerca</h3>


<form class="form-horizontal" mthod="post" action="Corsi_Segreteria" style="position:relative;left:-50px">
<fieldset>
    
<div class="control-group">
    <label class="control-label">Nome corso</label>
    <div class="controls">
        <input type="text" class="input-medium"  name="corso_nome">&nbsp;
        <input type="submit" class="btn btn-primary"  name="button_cerca" value="Cerca">
    </div>
</div>
    
<div class="control-group">
    <label class="control-label">Nome docente</label>
    <div class="controls">
        <input type="text" class="input-medium"  name="corso_docente">
    </div>
</div>
    
<div class="control-group">
    <label class="control-label">Crediti</label>
    <div class="controls">
    <input class="input-medium" name="corso_crediti">
    </div>
</div>
        
<div class="control-group">
    <label class="control-label">Periodo</label>
    <div class="controls">
    <input class="input-medium" name="corso_periodo">
    </div>
</div>
    
</fieldset>
</form>
    
</div>

<div style="position:absolute;left:190px;top:430px">
    <h4>Risultati ricerca</h4>
</div>

<div style="position:absolute;left:190px;top:461px;width:320px;height:450px;overflow:auto;">
<table id="selectable" class="table table-bordered" >
<tr id ="Row-0">
    <th>
        Risultato
    </th>
</tr>
<c:forEach items="${result}" var="course">
                        <tr id="${course.id}">
                        <td style="cursor:pointer"><c:out value="${course.nome}"/></td>
                        </tr>            
</c:forEach>

</table>
</div>

<div style="position:absolute;left:550px;top:162px">
    <h3>Corso Selezionato</h3>
    
<table class="table table-bordered" style="width:468px" id="table_corsi">
<tr>
<th colspan="2"> 
    Informazioni corso
</th>
</tr>

<tr>
<td style="width:190px;">
Nome Corso
</td>
<td>
    <jsp:getProperty name = "corso" property="nome"></jsp:getProperty>
</td>
</tr>


<tr>
<td style="width:190px">
Tipo
</td>
<td>  <%
        if(!("".equals(corso.getNome()))) 
          if(corso.isEsterno())
            out.append("Esterno");
          else
            out.append("Interno");
        else
          out.append("");
        
     %>
</td>
</tr>

<tr>
<td style="width:190px;">
Periodo
</td>
<td>
    <jsp:getProperty name = "corso" property="periodo"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Crediti
</td>
<td>
    <jsp:getProperty name = "corso" property="crediti"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Data inizio lezioni
</td>
<td>
    <jsp:getProperty name = "corso" property="data_inizio"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Aula lezioni
</td>
<td>
    <jsp:getProperty name = "corso" property="aula_lezioni"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Numero iscritti
</td>
<td>
    <jsp:getProperty name = "corso" property="numero_iscritti"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Url al corso
</td>
<td>
    <jsp:getProperty name = "corso" property="url_corso"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Nome del docente
</td>
<td>
    <jsp:getProperty name = "corso" property="docente"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px;">
Email del docente
</td>
<td>
    <jsp:getProperty name = "corso" property="email"></jsp:getProperty>
</td>
</tr>

<tr>
<td style="width:190px">
Note del docente
</td>
<td>
    <jsp:getProperty name = "corso" property="note"></jsp:getProperty>
</td>
</tr>

</table> 

<input type="button" class="btn" style="position:relative;top:2px" onClick="document.location.href='Aggiungicorso_Segreteria'; ;return false;" name="aggiungi_corso" value="Aggiungi corso">


</div>

</body>

</html>
